// pages/discover/discover.js
Page({
  data: {
    currentCategory: 'basic' // 默认选中基础教育
  },

  // 切换分类
  switchCategory: function(e) {
    this.setData({
      currentCategory: e.currentTarget.dataset.category
    });
  },

  // 跳转到详情页
  navigateToDetail: function(e) {
    const bookId = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/reading/reading?id=${bookId}`
    });
  },

  // 阻止事件冒泡
  stopPropagation: function(e) {
    return false;
  }
});